package com.rp.system.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.rp.common.utils.RpUtil;
import com.rp.log.annotation.RpLog;
import com.rp.system.dao.DataDicDao;
import com.rp.system.dao.DataDicTypeDao;
import com.rp.system.po.DataDic;

@Service
@Transactional
public class DataDicService {

	@Autowired
	private DataDicDao ddDao;
	@Autowired
	private DataDicTypeDao ddtDao;
	
	
	@RpLog(desc="新增数据字典字段")
	public String addDataDic(DataDic dd){
		dd.setId(RpUtil.createGuid());
		dd.setCreateDate(RpUtil.getCurrentDatetime());
		return (String) ddDao.save(dd);
	}
	
	@RpLog(desc="更新数据字典字段")
	public void updateDateDic(DataDic dd){
		dd.setUpdateDate(RpUtil.getCurrentDatetime());
		ddDao.update(dd);
	}
	
	@RpLog(desc="删除数据字典字段")
	public void deleteDataDic(DataDic dd){
		ddDao.delete(dd);
	}
	
	
	@RpLog(desc="删除数据字典类型")
	public void deleteDataDicType(String typeId){
		ddtDao.delete(typeId);
	}
	
	
	public DataDicDao getDdDao() {
		return ddDao;
	}
	
	public DataDicTypeDao getDdtDao() {
		return ddtDao;
	}
	
}
